package cn.kpi.common.Excel;

/**
 * 怎么使用
 *
 * @author lex
 * @create 2018-06-18-20:32
 */
public class ExportHowToUse {

//    @PostMapping(value="/rawmaterials/export")
//    public ResponseEntity<?>  exportRawmaterialsbbybExcel(@RequestBody Map<String, Object> models) throws Exception {
//        String fileName ="xxx绩效考核.xls";
//        List<RawMaterialsVo> rawMaterialsVos= JsonXMLUtils.obj2ListEntity(models.get("modelVos"),RawMaterialsVo.class);
//        SubheadingVo subheadingVo =  JsonXMLUtils.obj2Entity((Map<String, Object>)models.get("subheadingVo"),SubheadingVo.class);
//        subheadingVo.setHeader("外购原料完成进度");
//        subheadingVo.setSheetName("外购原料");
//        ExportConfig exportConfig = ExportConfigFactory.getExportConfig(ScheduleTrackingController.class.getResourceAsStream("/export/exportConfig.xml"));
//        ExportResult exportResult = FileExportor.getExportResult(exportConfig, rawMaterialsVos,subheadingVo);
//        String saveUrl ="c://export/temp";//服务器缓存地址
//        String saveFileUrl = getSavePath(saveUrl)+ getKey()+fileName;
//        OutputStream outputStream = new FileOutputStream(saveFileUrl);
//        exportResult.export(outputStream);
//        Path path = Paths.get(saveFileUrl);
//        Resource file = new UrlResource(path.toUri());
//        return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
//                "attachment; filename=\"" + URLEncoder.encode(file.getFilename(),"UTF-8") + "\"").body(file);
//
//    }
}
